package cn.lingyangwl.agile.auth.manager;

import cn.lingyangwl.framework.tool.core.CollectionUtils;
import cn.lingyangwl.agile.auth.mapper.ThirdUserMapper;
import cn.lingyangwl.agile.auth.model.entity.ThirdUser;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author shenguangyang
 */
@Component
public class ThirdUserManager extends ServiceImpl<ThirdUserMapper, ThirdUser> {

    public boolean deleteAuthByUserId(Long userId) {
        return this.remove(ThirdUser.lqw().eq(ThirdUser::getUserId, userId));
    }

    public void batchDeleteAuthByUserIds(List<Long> userIds) {
        if (CollectionUtils.isEmpty(userIds)) {
            return;
        }
        this.remove(ThirdUser.lqw().in(ThirdUser::getUserId, userIds));
    }
}
